package com.os.config;

import com.os.rs.backblaze.ReedSolomon;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author 风亦未止
 * @date 2023/5/12 20:11
 */
@Configuration
public class RsConfig {

    @Value("${data.shards.data}")
    public int DATA_SHARDS;
    @Value("${data.shards.parity}")
    public int PARITY_SHARDS;

    public int TOTAL_SHARDS;

    public int BYTES_IN_INT = 4;

    @Value("${data.repair}")
    public boolean isRepair;

    public ReedSolomon reedSolomon;

    @PostConstruct
    public  void init(){
         this.TOTAL_SHARDS = DATA_SHARDS + PARITY_SHARDS;
         this.reedSolomon = new ReedSolomon(DATA_SHARDS, PARITY_SHARDS);
    }

}
